﻿using System;

namespace ConsoleApp1
{

    class Program
    {
        static void Main(string[] args)
        {
            Random rn = new Random();
            Console.WriteLine("---------------欢迎进入游戏世界----------------------");
            Console.WriteLine("****************************************************");
            Console.WriteLine("*************猜拳，开始*****************************");
            Console.WriteLine("****************************************************");
            Console.WriteLine("出拳规则：1.剪刀    2.石头    3.布");
            Console.WriteLine("请选择对方角色（1.刘备 2.孙权 3.曹操）");
            int NPC = int.Parse(Console.ReadLine());
            string nam = "刘备";
            if (NPC==2)
            {
                nam= "孙权";
            }
            if (NPC == 3)
            {
                nam = "曹操";
            }
            Npc npc = new Npc(nam);

            Console.WriteLine("请输入你的角色名");
            Player player = new Player(Console.ReadLine());
            Console.WriteLine(player.Name+"VS"+npc.Name+"  对战");
            Console.WriteLine("开始游戏吗？（y/n）");
            string begin = Console.ReadLine();
                int fenshu1= 0;
                int fenshu2 = 0;
            while (Judge(begin))
            {
                Console.WriteLine("请出拳：1.剪刀    2.石头    3.布（输入相应数字）");
                int ab = int.Parse(Console.ReadLine());
                if (ab==1){Console.WriteLine(player.Name + ": 出拳:  剪刀" );}                
                if (ab==2){Console.WriteLine(player.Name + ": 出拳:  石头");}                
                if (ab==3){Console.WriteLine(player.Name + ": 出拳:  布");}
                int ac=rn.Next(0,3);
                if (ac==1){Console.WriteLine(npc.Name + ": 出拳:  剪刀"); }
                if (ac==2){Console.WriteLine(npc.Name + ": 出拳:  石头");}
                if (ac==3){Console.WriteLine(npc.Name + ": 出拳:  布"); }

                if (ab==1)
                {
                    if (ac==3) {
                        Console.WriteLine("恭喜，{0}赢了", player.Name);
                        fenshu1++;}
                    if (ac==2)
                    {
                        Console.WriteLine("笨蛋，{0}输了",player.Name );
                        fenshu2++;
                    }
                }               
                if (ab==2)
                {
                    if (ac==1) {
                        Console.WriteLine("恭喜，{0}赢了", player.Name);
                        fenshu1++;}
                    if (ac==3)
                    {
                        Console.WriteLine("笨蛋，{0}输了",player.Name );
                        fenshu2++;
                    }
                }                
                if (ab==3)
                {
                    if (ac==2) {
                        Console.WriteLine("恭喜，{0}赢了", player.Name);
                        fenshu1++;}
                    if (ac==1)
                    {
                        Console.WriteLine("笨蛋，{0}输了",player.Name );
                        fenshu2++;
                    }
                }
                    if (ac==ab)
                    {
                        Console.WriteLine("嘻嘻，和局{0}走着瞧.....", player.Name);
                    }

            






                Console.WriteLine("是否开始下一轮？（y/n）");
                begin = Console.ReadLine();
                Judge(begin);

            }
            Console.WriteLine("***姓名******得分******");
            Console.WriteLine(" "+ player.Name+"    "+fenshu1);
            Console.WriteLine(" " + npc.Name + "    " + fenshu2);
            if (fenshu1 > fenshu2)
            {Console.WriteLine(player.Name + "赢了，这个" + npc.Name + "就是逊了啦");}
            else { Console.WriteLine(npc.Name + "赢了，这个" +player.Name  + "就是逊了啦"); }
            Console.ReadKey();
        }
            public static bool Judge(string begin)
            {
            bool whether;
            if (begin == "y")
            { whether = true; }
            else { whether = false; }
            return whether;
             }
    }

    class Role
    {

        public string Name { get; set; }//角色名字
        public virtual void Throw() { }//出拳的方法
        public Role(string Name) {
            this.Name = Name;
        }
    }

    class Player : Role//玩家
    {

        public override void Throw()
        {
            int a = int.Parse(Console.ReadLine());
        }

        public Player(string Name):base(Name){ }

    }
    class Npc : Role//NPC
    {

        public override void Throw()//讲骚话
        {
        }
        public Npc(string Name) : base(Name) { }
        }

    
}